# File copy using SCP ***Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.*** --- **SCP** (**Secure Copy Protocol**) is a secure file transfer tool based on **SSH**, used for encrypting and transferring files and directories between local and remote hosts. # Common scenarios All commands are executed in the local command-line terminal. - Transfer files between a local host and a remote host (Local → Remote): ```bash scp /local/file.txt username@remote_IP:/target path/ ``` Example: ```bash scp ~/test.zip pi@192.168.2.xxx:/home/pi/ # Copy to the remote host's home directory. ``` - Transfer files between two remote hosts (Remote → Remote): ```bash scp user1@host1:/path/to/file user2@host2:/path/to/dest/ ``` Example: ```bash scp alice@server1:/data/report.txt bob@server2:/backups/ ``` - Transfer files from a remote host to a local host (Remote → Local): ```bash scp username@remote_IP:/remote/file.txt /local/path/ ``` Example: ```bash scp root@192.168.2.xxx:/var/log/app.log ./downloads/ # Download a remote file to a local host. ``` # Recursively copy directories Copy an entire folder (including subfiles and subdirectories): ```bash scp -r /local/directory/ user@host:/target path/ ``` Example: ```bash scp -r ~/my_project/ root@192.168.2.xxx:/home/pi/ ```